package com.sapitest.script.goodslisttest.paracheck;

import com.sapitest.imp.TestCases;
import com.sapitest.imp.TestData;
import com.sapitest.keywords.asserts.BaseAssert;
import com.sapitest.keywords.asserts.JSONAssert;
import com.sapitest.utils.ConfigFile;
import com.sapitest.utils.bean.Response;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

/**
 * 接口/v1/goodslist参数deviceInfo.meid校验
 */
public class DeviceInfo_MeidTest {
    @BeforeClass
    public void beforeClass() {
    }

    @Test(description= "deviceInfo.meid为null")
    public void testcase001(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),45);
        Response response = TestCases.testMyShoppingTrolley(45);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @Test(description= "deviceInfo.meid为空")
    public void testcase002(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),46);
        Response response = TestCases.testMyShoppingTrolley(46);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @Test(description= "deviceInfo.meid长度超过40")
    public void testcase003(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),47);
        Response response = TestCases.testMyShoppingTrolley(47);
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @Test(description= "deviceInfo.meid不传")
    public void testcase004(){
        String exp = TestData.getExpResponseData(ConfigFile.getTestParameter("MY_SHOPPING_TROLLEY_TABLE"),48);
        Response response = TestCases.testMyShoppingTrolleyWithoutPara(48, "meid");
        BaseAssert.numEquals(response.getResponseCode(), 200);
        JSONAssert.jsonObjectEquals(response.getResponseBody(), exp);
    }

    @AfterClass
    public void afterClass() {
    }
}
